Skip to main content

Process Response

The response returned from the Payment Gateway would be in a field called data. This would be encrypted using the same set of AES - IV & Secret Keys and hence would need to be decrypted using HesabeCrypt library’s decrypt function. The value after decryption would be like on the right.

Sample Response

{
"status": true,
"code": 1,
"message": "Transaction Success",
"response": {
"data": {
"resultCode": "CAPTURED",
"amount": 10,
"paymentToken": "1569830677725743478",
"paymentId": "100201927384634224",
"paidOn": "2019-09-30 11:05:16",
"orderReferenceNumber": null,
"variable1": null,
"variable2": null,
"variable3": null,
"variable4": null,
"variable5": null,
"method": 1,
"administrativeCharge": "5"
}
}
}

Response Parameters

FieldTypeDescription
statusBooleanPayment status (true for success; false for failure)
resultCodeStringSuccess transactions have values "CAPTURED", "ACCEPT", or "SUCCESS"
amountNumericAmount must be greater than zero
paymentTokenNumeric14-digit Payment Token returned from Hesabe
paymentIdAlphanumericPayment Id returned from Hesabe
paidOnAlphanumericDate and Time of Payment
orderReferenceNumberAlphanumericCustom user parameter passed in the request
variable1AlphanumericCustom user parameter included in the response
variable2AlphanumericCustom user parameter included in the response
variable3AlphanumericCustom user parameter included in the response
variable4AlphanumericCustom user parameter included in the response
variable5AlphanumericCustom user parameter included in the response
methodNumeric1 or 2 (1 for KNET; 2 for MPGS)
administrativeChargeNumericAdministrative Charge

Error Codes

CodeDescription
0Invalid Response
422Invalid Input
500Invalid Token
501Invalid Merchant
503Invalid Merchant Service
504Invalid Merchant Login Credentials
505Invalid Payment Token
506Invalid Request Data
507Transaction Error

Based on the status (success or failure), appropriate messages can be shown by the client on the confirmation page.